调整经纬度解析接口

FFIB 4 年之前
父节点
当前提交
81c1b4a06f
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 2
      commands/management/commands/gis.py
  2. 1 1
      kodo/settings.py

+ 2 - 2
commands/management/commands/gis.py

@@ -40,11 +40,11 @@ class Command(CompatibilityBaseCommand):
40 40
 
41 41
             with transaction.atomic():
42 42
                 try:
43
-                    gisinfo = requests.get(settings.GIS_2_ADMINISTRATIVE_DIVISION.format(v.get('lat', 0), v.get('lon', 0))).json()
43
+                    gisinfo = requests.get(settings.GIS_2_ADMINISTRATIVE_DIVISION.format(v.get('lat', 0), v.get('lon', 0)), verify=False).json()
44 44
                 except Exception as e:
45 45
                     logger.info(e.message)
46 46
 
47
-                zh1 = gisinfo.get('data', {}).get('zh1', '')
47
+                zh1 = gisinfo.get('result', {}).get('address_component', {}).get('province', '')
48 48
 
49 49
                 province_code = ProvinceModelMixin.PROVINCE_NAME_CODE_DICT.get(zh1) if zh1 else ''
50 50
 

+ 1 - 1
kodo/settings.py

@@ -415,7 +415,7 @@ KODO_DEFAULT_BRAND_NAME = ''
415 415
 KODO_DEFAULT_BRAND_DOMAIN = ''
416 416
 
417 417
 # 经纬度
418
-GIS_2_ADMINISTRATIVE_DIVISION = 'http://116.196.105.215:1234/gis?auth_user=freevip&latitude={0}&longitude={1}'
418
+GIS_2_ADMINISTRATIVE_DIVISION = 'https://apis.map.qq.com/ws/geocoder/v1/?key=4FNBZ-TIIKW-MWJRQ-RHZJN-W6F7Q-BFBKX&location={0},{1}'
419 419
 PHONE_2_ADMINISTRATIVE_DIVISION = 'https://www.baifubao.com/callback?cmd=1059&callback=phone&phone={0}'
420 420
 
421 421
 TESTING_SNS = ['000000']